package com.hanser.hancoder.config;

import com.hanser.hancoder.utils.WebScreenshotUtils;
import jakarta.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

/**
 * WebDriver清理配置
 * 确保应用关闭时清理所有浏览器实例
 */
@Slf4j
@Configuration
public class WebDriverCleanupConfig {

    @PreDestroy
    public void cleanup() {
        log.info("应用关闭中，开始清理WebDriver实例...");
        WebScreenshotUtils.destroyAllDrivers();
        log.info("WebDriver实例清理完成");
    }
}
